import 'package:built_collection/built_collection.dart';
import 'package:dartz/dartz.dart';
import 'package:equatable/equatable.dart';
import 'package:mobile_app.core/core/domain/entities/purchased_item/purchased_item.dart';

part 'failures/google_play_new_purchased_item_sync_failures.dart';

part 'failures/purchased_item_obtainment_failures.dart';

part 'failures/purchased_item_restoration_failures.dart';

part 'results/google_play_new_purchased_item_sync_result.dart';

part 'results/purchased_item_obtainment_result.dart';

part 'results/purchased_item_restoration_result.dart';

abstract class PurchasedItemApiRepository {
  Future<Either<PurchasedItemObtainmentFailure, PurchasedItemObtainmentResult>>
      obtainPurchasedItems({
    required String deviceId,
    required String? appStoreReceipt,
    required BuiltList<GooglePlayPurchasedItemIdentifier>? googlePlayPurchasedItemIdentifiers,
  });

  Future<Either<PurchasedItemRestorationFailure, PurchasedItemRestorationResult>>
      restorePurchasedItems({
    required String deviceId,
    required String? appStoreReceipt,
    required BuiltList<GooglePlayPurchasedItemIdentifier>? googlePlayPurchasedItemIdentifiers,
  });

  Future<Either<GooglePlayNewPurchasedItemSyncFailure, GooglePlayNewPurchasedItemSyncResult>>
      syncGooglePlayNewPurchasedItem({
    required GooglePlayPurchasedItemIdentifier newPurchasedItemIdentifier,
    required BuiltList<GooglePlayPurchasedItemIdentifier> previousPurchasedItemIdentifiers,
    required String? deviceId,
  });
}
